package DEMO1;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Component;

import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedArrayType;

public class demo {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
//        1.实例化并调用方法
        PERSON p1 = new PERSON();
        p1.sayHello();

        Class cls = Class.forName("demo1.PERSON");
        PERSON p2 = (PERSON) cls.newInstance();
        p2.sayHello();

//        扫描那个包
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext("demo1");
        PERSON p3 = context.getBean(PERSON.class);
        p3.sayHello();

    }
}
